#include "Command.h"
#include "../../Utility/Draw/Renderer.h"
namespace MenuScene
{
	Command::Command(Cursor* cursor, TextureID texID, Scene scene): 
		_texID(texID),
		_pos(Vector2::zero()),
		_cursor(cursor),
		_nextScene(scene){}

	void Command::initialize(int commandNum)
	{
		_pos = Vector2(Screen::getInstance()->getHalfWidth(), getHeight(commandNum));
	}

	float Command::getHeight(int commandNum)const{
		return (float)(commandNum * MenuData::getInstance()->getCommandInterval()) + MenuData::getInstance()->getCommandTotalHeight();
	}

	void Command::updatePos(int commandNum)
	{
		setDefaultCommandPos();

		if(isSelectCommand(commandNum))
		{
			setSelectCommandPos();
		}
	}

	void Command::draw()
	{
		Renderer::getInstance()->draw2DCenter(_texID, _pos);
	}
};